package web.manager;

import bean.Manager;
import com.alibaba.fastjson.JSON;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

@WebServlet(name = "ManagerInfo", urlPatterns = "/dao/managerInfo")
public class ManagerInfo extends HttpServlet {

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Manager manager = (Manager) request.getSession().getAttribute("manager");
        response.getWriter().write(URLEncoder.encode(JSON.toJSONString(manager), StandardCharsets.UTF_8));
    }
}
